
package com.ats.feeder.model.entitymanagers.admin.institutes;

import ${ObjectMap.EM_PACKAGE}.${ObjectMap.OBJECT_CODE_CAMLE_CASE};
import com.ats.feeder.model.entitymanagers.AbstractFacade;
import java.math.BigInteger;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class ${ObjectMap.OBJECT_CODE_CAMLE_CASE}Facade extends AbstractFacade<${ObjectMap.OBJECT_CODE_CAMLE_CASE}> implements ${ObjectMap.OBJECT_CODE_CAMLE_CASE}FacadeLocal {
    @PersistenceContext(unitName = "DefaultPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ${ObjectMap.OBJECT_CODE_CAMLE_CASE}Facade() {
        super(${ObjectMap.OBJECT_CODE_CAMLE_CASE}.class);
    }

<#assign argument = "">

<#list ObjectMap.attributesList   as  myList>
    <#if myList.FILTER_BY = "true">
        <#if myList.ATTRIBUTE_CODE_DATATYPE !="Other">
                   <#assign argument = argument + myList.ATTRIBUTE_CODE_DATATYPE>
        <#else>
                   <#assign argument = argument + myList.FIELD_DATA_TYPE>
        </#if>
                    <#assign argument = argument + " " + myList.ATTRIBUTE_CODE_BEAN_PATTERN>
                   <#if myList_has_next><#assign argument = argument + ", "></#if>
    </#if>
</#list>

@Override
public List<${ObjectMap.OBJECT_CODE_CAMLE_CASE}> find${ObjectMap.OBJECT_CODE_CAMLE_CASE}ByCriterion (${argument}) {
    Query createNamedQuery = em.createNamedQuery("HesUsers.find${ObjectMap.OBJECT_CODE_CAMLE_CASE}ByCriterion");
    <#list ObjectMap.attributesList as  myList>
        <#if myList.FILTER_BY="true">
    createNamedQuery.setParameter("${myList.ATTRIBUTE_CODE_BEAN_PATTERN}", ${myList.ATTRIBUTE_CODE_BEAN_PATTERN});
        </#if>
    </#list>
    return createNamedQuery.getResultList();
}

}
